import request from "@/utils/request";

// 获取商品列表
export const getProductListApi = (data) => {
  return request({
    url: "/product/list",
    method: "post",
    data,
  });
};

// 查询设备信息列表
export function deviceListApi(query) {
  return request({
    url: "/device/list",
    method: "get",
    params: query,
  });
}

// 设备详请
export function deviceDetailApi(deviceId) {
  return request({
    url: "/device/" + deviceId,
    method: "get",
  });
}

// 删除设备
export function deleteDeviceApi(deviceIds) {
  return request({
    url: "/device/" + deviceIds,
    method: "delete",
  });
}

// 新增设备
export function addDeviceApi(data) {
  return request({
    url: "/device",
    method: "post",
    data: data,
  });
}

// 修改设备
export function updateDeviceApi(data) {
  return request({
    url: "/device",
    method: "put",
    data: data,
  });
}

// 注销设备
export function cancelDeviceApi(data) {
  return request({
    url: "/device/off",
    method: "post",
    data: data,
  });
}

// 获取所有设备绑定情况-0未绑定、1已绑定、2已注销
export function deviceInfoApi(query) {
  return request({
    url: "/device/info",
    method: "get",
    params: query,
  });
}

// 查询单个设备参数日志列表
export function paramLogListApi(query) {
  return request({
    url: "/param/log/list",
    method: "get",
    params: query,
  });
}

// 查询单个设备报警日志列表
export function alarmLogListApi(query) {
  return request({
    url: "/alarm/log/list",
    method: "get",
    params: query,
  });
}

// 查询单个设备参数日志列表
export function levelLogListApi(query) {
  return request({
    url: "/level/log/list",
    method: "get",
    params: query,
  });
}

// 对比设备参数日志信息，当前日志与最近前一条数据对比
export function paramLogCompareApi(query) {
  return request({
    url: "/param/log/compare",
    method: "get",
    params: query,
  });
}

// 对比设备水位日志信息，当前日志与最近前一条数据对比
export function levelLogCompareApi(query) {
  return request({
    url: "/level/log/compare",
    method: "get",
    params: query,
  });
}

// 对比设备报警日志信息，当前日志与最近前一条数据对比
export function alarmLogCompareApi(query) {
  return request({
    url: "/alarm/log/compare",
    method: "get",
    params: query,
  });
}

// 查询权限控制列表
export function controlListApi(query) {
  return request({
    url: "/control/list",
    method: "get",
    params: query,
  });
}

// 新增模块
export function controlAddApi(data) {
  return request({
    url: "/control",
    method: "POST",
    data: data,
  });
}

// 修改模块
export function controlUpdateApi(data) {
  return request({
    url: "/control",
    method: "PUT",
    data: data,
  });
}

// 删除模块
export function controlDeleteApi(controlIds) {
  return request({
    url: "/control/" + controlIds,
    method: "DELETE",
  });
}

// 导入设备
export function deviceImportDataApi(data) {
  return request({
    url: "/device/importData",
    method: "POST",
    data: data,
  });
}
